﻿using System;
using System.Diagnostics;

namespace Raytracer.Common
{
    public static class SpeedTest
    {
        public static void Measure(int a_repeats, string a_title, Action a_func)
        {
            Debug.Assert(a_repeats > 0);

            Stopwatch sw = new Stopwatch();

            sw.Start();

            for (int i = 0; i < a_repeats; i++)
                a_func();

            sw.Stop();

            System.Console.WriteLine("{0} - {1} [ops/s]", a_title, Math.Round(sw.ElapsedMilliseconds / 1000.0, 3));
        }
    }
}